<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>前台主页面</title>
    <link rel="stylesheet" type="text/css" th:href="@{/mystatic/bootstrap-3.4.1-dist/css/bootstrap.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/mystatic/bootstrap-3.4.1-dist/css/bootstrap-theme.css}"/>
</head>
<script type="text/javascript">
    function mychange(obj){
        //alert(obj);
        //alert(obj.value);
        window.location.href="list?index="+obj.value+"&size=5";
    }
    function mychangesize(obj){
        window.location.href="list?size="+obj.value;
    }
</script>
</head>
<body>
<p th:replace="sessionuser :: ftest"></p><!--替换掉宿主元素-->
<div class="container-fluid" >
    <div class="row">
        <div class="col-md-2"></div>
        <div class="col-md-8">
            <h2 align="center" >标题列表页面</h2>
            <table class="table table-hover" border="0" align="center" width="500px" >
                <tr>
                    <td>序号</td><td>标题</td><td>选项数</td><td>投票人数</td><td>操作</td>
                </tr>
                <tr th:each="v:${sublist}">
                    <td th:text="${v.vssid}"></td>
                    <td th:text="${v.vs_title}"></td>
                    <td th:text="${v.subcount}"></td>
                    <td th:text="${v.vicount}"></td>
                    <td><a th:href="@{/vote?(subid=${v.vssid})}" >参加投票</a> | <a th:href="@{/selectSubjectResultDetail?(subid=${v.vssid})}">投票结果</a></td>
                </tr>
            </table>
          <table border="0" align="center" width="500px" >
                <tr>
                    <td>共 <span th:text="${count}"></span> 行, 当前第
                        <select name="menu" onchange="mychange(this)" >
                                <option th:selected="${v eq index}"  th:each="v:${#numbers.sequence(1,max)}"  th:value="${v}" th:text="${v + '/' + max}"></option>
                        </select>
                        页</td>
                    <td th:if="${index eq 1}">首页</td>
                    <td th:if="${index eq 1}">上一页</td>
                    <td th:if="${index != 1}"><a th:href="@{/list?(index=1,size=${size})}">首页</a></td>
                    <td th:if="${index != 1}"><a th:href="@{/list?(index=${index-1},size=${size})}" >上一页</a></td>
                    <td th:if="${index eq max}">下一页</td>
                    <td th:if="${index eq max}">尾页</td>
                    <td th:if="${index != max}"><a th:href="@{/list?(index=${index+1},size=${size})}">下一页</a></td>
                    <td th:if="${index != max}"><a th:href="@{/list?(index=${max},size=${size})}">尾页</a></td>
                    <td>size:
                        <select name="size" onchange="mychangesize(this)" >
                            <option value="2" th:selected="${size eq 2}">2</option>
                            <option value="3" th:selected="${size eq 3}">3</option>
                            <option value="5" th:selected="${size eq 5}">5</option>
                    </select>
                    </td>
                </tr>
            </table>
        </div>
        <div class="col-md-2"></div>
    </div>
</div>
</body>
</html>